<?php
//$date = DateTime::createFromFormat('Y-m-d', $student->dob)->format('F d, Y');
//$bdate = explode(' ',$student->dob);
//$bdate_at = explode('-',$bdate[0]);
//$created = explode(' ',$student->created);
//$created_at = explode('-',$created[0]);
//var_dump($payment_record);
?>

<link rel="stylesheet" href="<?=style_url('yahoocssreset');?>">
<link rel="stylesheet" href="<?=style_url('formletter');?>">

<table border="0" cellpadding="0" cellspacing="0" style="width:818px; font-size:13px;">
<tr><td colspan="4" style="height:60px;">&nbsp;</td></tr>
<tr>
	<td style="width:49px;">&nbsp;</td>
	<td valign="top" style="width:360px;">
		<table border="0" cellpadding="0" cellspacing="0">
			<tr><td style="padding:4px;">&nbsp;&nbsp;&nbsp;&nbsp;Payee</td></tr>
			<tr><td style="width:250px;">
				<table border="0" cellpadding="0" cellspacing="0" style="width:250px; border:#000 1px solid;">
					<tr><td style="padding-top:4px; padding-bottom:3px; padding-left:4px;"><?php echo ucwords(strtolower($payee->lastname)).', '.ucwords(strtolower($payee->firstname)); ?><?php echo $payee->middlename!='' ? " ".ucwords($payee->middlename):""; ?> <?php if($payee->name_ext!=''){ echo $payee->name_ext=='jr' || $payee->name_ext == 'sr' ? ucwords(strtolower($payee->name_ext)):strtoupper($payee->name_ext); }else{ echo ''; } ?></td></tr>
					<tr><td style="padding-top:3px; padding-bottom:3px; padding-left:4px;"><?php if($payee->relation!=''){ echo $payee->relation!='' ? ucwords($payee->relation):"For"; }else{ echo '&nbsp;'; } ?></td></tr>
					<tr><td style="padding-top:3px; padding-bottom:3px; padding-left:4px;"><?php echo ucwords(strtolower($payment_record->lastname)).', '.ucwords(strtolower($payment_record->firstname)); ?><?php echo $payment_record->middlename!='' ? " ".ucwords($payment_record->middlename):""; ?> <?php if($payment_record->nameext!=''){ echo $payment_record->nameext=='jr' || $payment_record->nameext == 'sr' ? ucwords(strtolower($payment_record->nameext)):strtoupper($payment_record->nameext); }else{ echo ''; } ?></td></tr>
					<tr><td style="padding-top:3px; padding-bottom:4px; padding-left:4px;"><?php echo $payment_record->level_desc."-SY".$payment_record->e_sy_from."-".$payment_record->e_sy_to; ?></td></tr>
				</table>
			</td><td style="width:100px; vertical-align:bottom;">
				<table border="0" cellpadding="0" cellspacing="0">
					<tr><td style="padding:4px; text-align:center;">ID#</td></tr>
					<tr><td style="padding:4px; border-top:#000 1px solid; border-right:#000 1px solid; border-bottom:#000 1px solid; width:100px;"><?php echo $payment_record->e_student_id!=''?$payment_record->e_student_id:'&nbsp;';?></td></tr>
				</table>
			</td></tr>
		</table>
	</td>
	<td valign="top" style="width:360px;">
		<table border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td>
					<table border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td style="width:120px;">&nbsp;</td>
							<td style="text-align:center; padding:4px; width:120px;">Date</td>
							<td style="text-align:center; padding:4px; width:118px;">UR/OR#</td>
						</tr>
						<tr>
							<td>&nbsp;</td>
							<td style="text-align:center; padding:4px; border:#000 1px solid;"><?php echo date('m/d/Y',strtotime($dater)); ?></td>
							<td style="text-align:center; padding:4px; border-top:#000 1px solid; border-right:#000 1px solid; border-bottom:#000 1px solid;"><?php echo $payment_record->spr_or_no;?></td>
						</tr>
					</table>
				</td>
			</tr>
			<tr><td>&nbsp;</td></tr>
			<tr>
				<td>
					<table border="0" cellpadding="0" cellspacing="0" style="border:#000 1px solid;">
						<tr>
							<td style="text-align:center; padding:4px; border-right:#000 1px solid; border-bottom:#000 1px solid; width:120px;">Cheque No.</td>
							<td style="text-align:center; padding:4px; border-right:#000 1px solid; border-bottom:#000 1px solid; width:120px;">Payment Method</td>
							<td style="text-align:center; padding:4px; border-bottom:#000 1px solid; width:118px;">Due Date</td>
						</tr>
						<tr>
							<td style="text-align:center; padding:4px; border-right:#000 1px solid;"><?php if($payment_record->spr_mode_of_payment=='check/cheque'){ echo $payment_record->cheque_no; }elseif($payment_record->spr_mode_of_payment=='credit'){ echo $payment_record->credit_card_no; }elseif ($payment_record->spr_mode_of_payment=='cash') { echo'&nbsp;'; }else{ echo '&nbsp;'; } ?></td>
							<td style="text-align:center; padding:4px; border-top:#000 1px solid; border-right:#000 1px solid; border-left:#000 1px solid;"><?php echo $payment_record->spr_mode_of_payment=='credit'?ucwords($payment_record->credit_card_name):ucwords($payment_record->spr_mode_of_payment); ?></td>
							<td style="text-align:center; padding:4px;"><?php echo date('m/d/Y',strtotime($payment_record->payment_date)); ?></td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</td>
	<td style="width:49px;"></td>
</tr>
<tr><td colspan="4">&nbsp;</td></tr>
<tr><td>&nbsp;</td><td colspan="2">
<table border="0" cellpadding="0" cellspacing="0" style="border:#000 1px solid;">
	<tr><td style="width:110px; text-align:center; border-bottom:#000 1px solid; border-right:#000 1px solid; padding:4px;">Fees</td><td style="width:268px; text-align:center; border-bottom:#000 1px solid; border-right:#000 1px solid; padding:4px;">Description</td><td style="width:100px; text-align:center; border-bottom:#000 1px solid; border-right:#000 1px solid; padding:4px;">Qty</td><td style="width:120px; text-align:center; border-bottom:#000 1px solid; border-right:#000 1px solid; padding:4px;">Price</td><td style="width:120px; text-align:center; border-bottom:#000 1px solid; padding:4px;">Amount</td></tr>

	<?php
	$i = 1;
	$total = 0;

	?>
	<tr><td style="border-right:#000 1px solid; padding-top:2px; padding-right:2px; padding-bottom:2px; padding-left:4px;">Reservation Fee</td><td style="border-right:#000 1px solid; padding-top:2px; padding-right:2px; padding-bottom:2px; padding-left:4px;"><?php echo $payment_record->spb_fee_name;?></td><td style="border-right:#000 1px solid; padding:2px;">&nbsp;</td><td style="border-right:#000 1px solid; padding-top:2px; padding-right:4px; padding-bottom:2px; padding-left:4px; text-align:right;"><?php echo number_format($payment_record->spr_ammt_paid,2,'.',',');?></td><td style="vertical-align:top; padding-top:2px; padding-right:4px; padding-bottom:2px; padding-left:4px; text-align:right;"><?php echo number_format($payment_record->spr_ammt_paid,2,'.',',');?></td></tr>
	<?php
	$i = $i + 1;
	$total = $total + $payment_record->spr_ammt_paid;

	while($i <= 13)	{
	?>
	<tr><td style="border-right:#000 1px solid; padding-top:2px; padding-right:2px; padding-bottom:2px; padding-left:4px;">&nbsp;</td><td style="border-right:#000 1px solid; padding-top:2px; padding-right:2px; padding-bottom:2px; padding-left:4px;">&nbsp;</td><td style="border-right:#000 1px solid; padding:2px;">&nbsp;</td><td style="border-right:#000 1px solid; padding-top:2px; padding-right:4px; padding-bottom:2px; padding-left:4px; text-align:right;">&nbsp;</td><td style="vertical-align:top; padding-top:2px; padding-right:4px; padding-bottom:2px; padding-left:4px; text-align:right;">&nbsp;</td></tr>
	<?php
	$i = $i + 1;
	}
	?>

	<tr><td style="border-top:#000 1px solid;" colspan="3">&nbsp;</td><td style="border-top:#000 1px solid; border-right:#000 1px solid; padding:4px;">SUBTOTAL</td><td style="border-top:#000 1px solid; padding:4px; text-align:right;">PHP <?php echo number_format($total,2,'.',',');?></td></tr>

</table>
</td><td>&nbsp;</td></tr>
<tr><td>&nbsp;</td><td colspan="2">
	<table border="0" cellpadding="0" cellspacing="0" style="border-right:#000 1px solid; border-bottom:#000 1px solid; border-left:#000 1px solid;">
		<tr><td style="border-bottom:#000 1px solid; padding-top:4px; padding-right:20px; padding-bottom:4px; padding-left:20px; text-align:center;">Authorized Signature</td></tr>
		<tr><td style="padding-top:10px; padding-right:20px; padding-bottom:10px; padding-left:20px; text-align:center;"><?php echo $payment_record->first_name; ?><?php echo $payment_record->middle_name!=''?" ".$payment_record->middle_name:""; ?> <?php echo $payment_record->last_name; ?> <?php echo $payment_record->name_ext; ?></td></tr>
	</table>
</td><td>&nbsp;</td></tr>
</table>